package com.example.permission.service;

import com.example.permission.entity.Role;
import com.example.permission.mapper.RoleMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class RoleService {
    @Autowired
    private RoleMapper roleMapper;

    // 任务二：根据ID查询角色及其菜单
    public Role getRoleWithMenusById(Long roleId) {
        return roleMapper.selectRoleWithMenusById(roleId);
    }

    // 任务二：根据名称查询角色及其菜单
    public Role getRoleWithMenusByKey(String roleKey) {
        return roleMapper.selectRoleWithMenusByKey(roleKey);
    }
}